package com.qf.air.handler;

import com.qf.air.exception.AirException;
import com.qf.air.vo.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author zjw
 * @description
 * @date 2021/10/9 14:43
 */
@RestControllerAdvice
public class AirExceptionHandler {

    @ExceptionHandler(AirException.class)
    public R handler(AirException ex){
        System.out.println(ex);
        return R.error(ex.getCode(),ex.getMessage());
    }


    @ExceptionHandler(Exception.class)
    public R Exception(Exception ex){
        System.out.println(ex);
        return R.error(500,"未知异常！");
    }

}
